<?php

namespace App\Model;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Laravel\Passport\HasApiTokens;

/**
 * App\Model\User
 *
 * @mixin \Eloquent
 * @property int $id
 * @property int|null $pid
 * @property string|null $email 邮箱帐号
 * @property string|null $mobile
 * @property string $password
 * @property string|null $pay_password
 * @property int|null $pay_password_set 0:每次输入交易密码 1：每次登陆输入一次 2：每次都不用输
 * @property string|null $remember_token
 * @property int|null $email_status 0:位验证 1：已验证
 * @property int $status
 * @property \Carbon\Carbon|null $created_at
 * @property \Carbon\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereEmailStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereMobile($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User wherePassword($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User wherePayPassword($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User wherePayPasswordSet($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User wherePid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereRememberToken($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\User whereUpdatedAt($value)
 */
class User extends Authenticatable
{
    use HasApiTokens;

    public function findForPassport($login)
    {
        return $this->orWhere('email', $login)->orWhere('mobile', $login)->first();
    }
}